<?php

class admin extends db
{
  function get_settings($user_id)
  {
    $this->query("SELECT * FROM admin_settings WHERE user_id='$user_id'");
    if ($this->next_record())
    {
      return $this->Record;
    }else
    {
      $this->query("INSERT INTO admin_settings (user_id, sort_field, sort_order) 
	VALUES ('$user_id', 'name', 'ASC')");
      return $this->get_settings($user_id);
    }		
  }
  function set_sorting($user_id, $sort_field, $sort_order)
  {
    $sql = "UPDATE admin_settings SET sort_field='$sort_field' , 
      sort_order='$sort_order' WHERE user_id='$user_id'";
    return $this->query($sql);
  }
}
